package com.chinacoal.microservice.controller;

import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import com.chinacoal.microservice.AssessmentClient;
import com.chinacoal.microservice.pojo.AssessmentStatistics;
import com.chinacoal.microservice.pojo.CcmsSmartleasingAssessment;
import com.chinacoal.microservice.pojo.CcmsSmartleasingAssessmentScore;
import com.chinacoal.microservice.service.AssessmentService;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import com.chinacoal.microservice.util.UserLoginToken;

/**
 * 考核模块-考核管理控制类
 * @author wiilead
 *
 */
@RestController
public class AssessmentController implements AssessmentClient {
	@Autowired
	private AssessmentService assessmentService;

	/**
	 * 新增或修改考核
	 */
	@Override
	@UserLoginToken
	public Result addOrUpdateAssessment(CcmsSmartleasingAssessment assesment, String token) {
		// TODO Auto-generated method stub
		return assessmentService.addOrUpdateAssessment(assesment, token);
	}

	/**
	 * 查询考核列表
	 */
	@Override
	@UserLoginToken
	public Result<List<CcmsSmartleasingAssessment>> getAssessmentList(QueryCriteria queryCriteria,String token) {
		// TODO Auto-generated method stub
		return assessmentService.getAssessmentList(queryCriteria,token);
	}

	/**
	 * 查询考核详情
	 */
	@Override
	@UserLoginToken
	public Result<CcmsSmartleasingAssessment> getAssessmentInfo(String assessmentId,String token) {
		// TODO Auto-generated method stub
		return assessmentService.getAssessmentInfo(assessmentId,token);
	}

	/**
	 * 删除考核
	 */
	@Override
	@UserLoginToken
	public Result deleteAssessmemt(String assessmentId) {
		// TODO Auto-generated method stub
		return assessmentService.deleteAssessment(assessmentId);
	}

	/**
	 * 考核
	 */
	@Override
	@UserLoginToken
	public Result addAssessmentScore(List<CcmsSmartleasingAssessmentScore> assesmentScoreList, String token) {
		// TODO Auto-generated method stub
		return assessmentService.addAssessmentScore(assesmentScoreList,token);
	}

	/**
	 * 考核统计
	 */
	@Override
	@UserLoginToken
	public Result<List<AssessmentStatistics>> statisticsAssessmentList(QueryCriteria queryCriteria) {
		// TODO Auto-generated method stub
		return assessmentService.getAssessmentSatistics(queryCriteria);
	}

	/**
	 * 导出考核统计
	 */
	@Override
	@UserLoginToken
	public void exportExcel(HttpServletResponse response) throws Exception{
		// TODO Auto-generated method stub
		assessmentService.exportExcel(response);
	}
}
